#pragma once
#include<iostream>
#include<string>

using namespace std;


enum Error{
    DIVI_ZERO = 1
    ,MODE_ZERO
    ,UNKNOW
};




class Task
{
public:
    Task(int x, int y, char op)
    :_data1(x)
    ,_data2(y)
    ,_op(op)
    {}
    

    void run()
    {
        switch(_op)
        {
            case '+':
                _result = _data1 + _data2;
                break;
            case '-':
                _result = _data1 - _data2;
                break;
            case '*':
                _result = _data1 * _data2;
                break;
            case '/ ':
            {
                if(_data2 == 0)
                    _exitcode = DIVI_ZERO;
                else
                    _result = _data1 / _data2;
            }
            case '%':
            {
                if(_data2 == 0)
                    _exitcode = MODE_ZERO;
                else
                    _result = _data1 % _data2;
            }
            
            default:
                _exitcode = UNKNOW;
                break;
        }
    }

    string GetResult()
    {
        string r = to_string(_data1);
        r += _op;
        r += to_string(_data2);
        r += "=";
        r += to_string(_result);
        r += "[";
        r += to_string(_exitcode);
        r =+ "]";
        return r;
    }


    ~Task()
    {}
private:
    int _data1;
    int _data2;
    char _op;

    int _result;
    int _exitcode;
};